package cz.hackathon.core;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import cz.hackathon.rateit.model.Action;
import cz.hackathon.rateit.model.Category;
import cz.hackathon.rateit.model.Item;

public class Controller {

	public static Set<Category> getCategories(Action action) {
		Set<Category> set = new HashSet<Category>();
		for (Item item : action.getItems()) {
			set.add(item.getCategory());
		}
		return set;
	}

	public static List<Item> getItemsByCategory(Action action, Category category) {
		ArrayList<Item> list = new ArrayList<Item>();
		for (Item item : action.getItems()) {
			if (item.getCategory().equals(category)) {
				list.add(item);
			}
		}
		return list;
	}

}
